package com.lyf.viewapp.category;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lyf.viewapp.R;
import com.lyf.viewapp.category.dropdownmenu.DropDownMenuActivity;
import com.lyf.viewapp.category.jdandtb.JdAndTbActivity;
import com.lyf.viewapp.category.pickerview.PickerViewMainActivity;
import com.lyf.viewapp.list.animators.RecyclerviewAnimatorsAdapter;
import com.lyf.viewapp.util.EnterBean;
import com.lyf.viewapp.util.EnterRecyclerAdapter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.recyclerview.animators.SlideInLeftAnimator;

/**
 * 分类首页
 *
 * @author lyf
 */
public class CategoryMainActivity extends AppCompatActivity {

    @BindView(R.id.category_main_list)
    RecyclerView recyclerView;

    private List<EnterBean> data;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_category_main);
        ButterKnife.bind(this);

        initView();
    }

    private void initView() {

        data = new ArrayList<>();
        data.add(new EnterBean("JdAndTbCategory",JdAndTbActivity.class));
        data.add(new EnterBean("DropDownMenu",DropDownMenuActivity.class));
        data.add(new EnterBean("PickerView",PickerViewMainActivity.class));

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        EnterRecyclerAdapter adapter = new EnterRecyclerAdapter(R.layout.main_item,data);
        adapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM);
        recyclerView.setAdapter(adapter);
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent(CategoryMainActivity.this, data.get(position).getActivity());
                startActivity(intent);
            }
        });
    }

}
